package com.jin.springcloud.justtest.controller;

import com.jin.springcloud.justtest.dto.UserDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
//启动类注解SpringBootApplication已包含EnableConfigurationProperties注解
//@EnableConfigurationProperties({UserDTO.class})
@RequestMapping("user")
@Api(value = "User相关接口",tags = {"User接口"})
public class UserController {

    @Autowired
    private UserDTO userDTO;

    @ApiOperation(value = "接口getUserInfo", notes = "获取用户信息")
    @RequestMapping(value = "/userInfo")
    public String getUserInfo(){
        return userDTO.toString();
    }


    @ApiOperation(value = "接口sayHi", notes = "打招呼")
    @RequestMapping(value = "/{name}")
    public String sayHi(@PathVariable @ApiParam(name = "你的姓名",value = "我是value") String name){
        return "Hi, "+name;
    }

    public static void main(String[] args) {
        RestTemplate template = new RestTemplate();
        System.out.println(template.getForEntity("http://jin123.capsui.com/lightcity/getActivityInfo", String.class));
    }
}
